package edu.cuit.zhuyimeng.ticket.job;

import edu.cuit.zhuyimeng.ticket.service.ITicketDispatchService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;

/**
 * 关闭订票任务
 */
@Component("closeTicketProcessor")
@Slf4j
@RequiredArgsConstructor
public class CloseTicketProcessor implements BasicProcessor {

    private final ITicketDispatchService ticketDispatchService;

    @Override
    public ProcessResult process(TaskContext context) throws Exception {

        ticketDispatchService.closeTicketDispatch(Long.parseLong(context.getJobParams()));

        return new ProcessResult(true,"成功");
    }
}
